<style>
.tags1 .el-input--suffix .el-input__inner {
  height: 30px;
}
.tags1 .content_button .el-button {
  margin-right: 15px;
}
.tags1 .el-input__icon {
  line-height: 30px;
}
.tags1 .connect .el-input__inner {
  height: 30px;
}
.tags1 .content_tab2 .el-input__inner {
  height: 30px;
}
</style>

<style scoped>
.tags1 {
  margin-right: 0.5vw;
  padding: 0 15px;
  background-color: white;
  height: 95vh;
  position: relative;
}
.tags1_top {
  padding-top: 10px;
  height: 130px;
  white-space: nowrap;
  border-bottom: 1px solid #dbdbdb;
}
.tags1_top > div {
  white-space: nowrap;
  margin-top: 5px;
  height: 32px;
  position: relative;
}
.tags1_top p {
  display: inline-block;
  width: 70px;
  text-align: right;
}
.in {
  height: 30px;
  width: 160px;
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  padding: 0 15px;
  margin-left: 10px;
  color: #606266;
}
.in:focus {
  outline: none;
  border: 1px solid #017aff;
}
.content_inp table {
  width: 100%;
  border-collapse: collapse;
}
.content_inp td {
  height: 30px;
  border: 1px solid #dcdfe6;
}
.in2:focus {
  outline: none;
  border: 1px solid #017aff;
}
.in1_5:focus {
  outline: none;
  border: 1px solid #017aff;
}
.in2 {
  width: 100%;
  height: 30px;
  border: none;
}
.tags_check {
  margin: 3px 0 0 5px;
}
.bj {
  margin-top: 5px;
}
.container {
  width: 100%;
  display: flex;
  height: 80%;
}
.content1 {
  width: 40%;
  white-space: nowrap;
}
.content2 {
  width: 60%;
  border-left: 1px solid #dbdbdb;
  height: 100%;
  padding: 15px 0 0 15px;
  white-space: nowrap;
}
.washImg input {
  width: 30px;
  height: 30px;
  border: #dcdfe6 solid 1px;
  border-radius: 5px;
  margin-left: 10px;
  outline: none;
  padding: 0 5px;
}
.washImg input:focus {
  border: 1px solid #017aff;
}
.content_button {
  display: flex;
  margin: 10px 0 15px 0;
}
.content_box1 {
  height: 76%;
  margin-right: 15px;
}
.content_box1 p {
  font-weight: 700;
  margin-bottom: 15px;
  color: #222;
}
.content_box1 table {
  width: 100%;
  border: 2px solid #f5f5f5;
  border-collapse: collapse;
  margin-bottom: 15px;
}
.content_box1 th,
.content_box1 td {
  height: 30px;
  width: 128px;
  border: 2px solid #f5f5f5;
  line-height: 30px;
  text-align: center;
  color: #606266;
}
.content_box1 th {
  background-color: #f5f5f5;
  font-size: 14px;
}
.content_tab {
  display: flex;
  justify-content: space-around;
  height: 35px;
  margin-top: 12px;
  padding-top: 6px;
  background: #dbdbdb;
}
.content_tab p {
  font-size: 15px;
}
.tab1 {
  margin-left: -20px;
}
.c-bottom {
  white-space: nowrap;
}
.c-bottom div,
.last {
  border-radius: 30px;
  padding: 5px 10px;
  background-color: #f2f2f2;
  display: inline-block;
}
.c-bottom p,
.last p {
  display: inline-block;
}

.c2_box1 {
  display: flex;
  margin-top: 10px;
  white-space: nowrap;
}
.c2_box1 p {
  display: inline-block;
  width: 75px;
  text-align: right;
}
.content_tab2 {
  margin-top: 10px;
}

.footView span {
  float: left;
  margin-right: 48px;
  line-height: 6vh;
  font-size: 14px;
}
.connect {
  margin: 10px 10px;
}
.connect1 {
  text-align: center;
  display: flex;
}
.dyState {
  display: flex;
  margin-top: 10px;
}
</style>

<template>
  <div class="tags1">
    <div class="tags1_top">
      <div>
        <p>款号</p>
        <input v-model="styleNumber" type="text" class="in" disabled />
        <p>颜色</p>
        <input
          v-model="colorNo"
          type="text"
          class="in"
          style="width: 70px"
          disabled
        />
        <input
          v-model="color"
          type="text"
          class="in"
          style="width: 80px"
          disabled
        />
        <el-tooltip
          class="item"
          effect="dark"
          :content="otherColor != '' ? otherColor : '暂无数据'"
          placement="top"
        >
          <p>其他颜色</p>
        </el-tooltip>
        <input v-model="otherColor" type="text" class="in" disabled />
        <p>品名</p>
        <input v-model="commodityName" type="text" class="in" disabled />
        <p>产地</p>
        <el-select
          v-model="city"
          style="width: 90px; height: 30px; margin-left: 10px"
          :disabled="!alternatives"
        >
          <el-option
            v-for="item in area"
            :key="item.value + Math.random()"
            :label="item.label"
            :value="item.value"
          ></el-option>
        </el-select>
        <el-checkbox class="tags_check" v-model="alternatives"
          >备选项</el-checkbox
        >
        <p>标准</p>
        <input v-model="standard" type="text" class="in" disabled />
        <p>附件</p>
        <input v-model="accessoryName" type="text" class="in" disabled />
      </div>
      <div>
        <p>尺码</p>
        <input v-model="size" type="text" class="in" disabled />
        <el-tooltip
          class="item"
          effect="dark"
          :content="otherSize != '' ? otherSize : '暂无数据'"
          placement="top"
        >
          <p>其他尺码</p>
        </el-tooltip>
        <input v-model="otherSize" type="text" class="in" disabled />
        <p>搭配款</p>
        <input v-model="matchStyle" type="text" class="in" disabled />
        <p>安全类别</p>
        <input v-model="safetyType" type="text" class="in" disabled />
        <p>金属纤维</p>
        <input v-model="isIncludeMetalFibre" type="text" class="in" disabled />
        <p>含绒量</p>
        <input v-model="downcontent" type="text" class="in" disabled />
        <p>充绒量</p>
        <input v-model="fillcontent" type="text" class="in" disabled />
      </div>
      <div style="display: flex">
        <p>ENA13</p>
        <input v-model="ean13No" type="text" class="in" disabled />
        <p>品牌</p>
        <input v-model="brandedName" type="text" class="in" disabled />
        <p>检验员</p>
        <input
          v-model="operator"
          type="text"
          class="in"
          :disabled="!changeOperator"
          @blur="leaveOperator"
        />
        <el-checkbox class="tags_check" v-model="changeOperator"
          >手动改检验员</el-checkbox
        >
        <!-- TEST -->
      </div>
    </div>
    <div class="container">
      <!-- 左边框 -->
      <div class="content1">
        <div class="content_button">
          <el-button icon="el-icon-edit-outline">改进退ID</el-button>
          <el-button @click="dele">清除缓存</el-button>
        </div>
        <div class="content_box1">
          <p>面料成份</p>
          <table>
            <tr>
              <th>成份1</th>
              <th>成份2</th>
              <th>成份3</th>
              <th>成份4</th>
              <th>成份5</th>
            </tr>
            <tr>
              <td>{{ ingredientOne }}</td>
              <td>{{ ingredientTwo }}</td>
              <td>{{ ingredientThree }}</td>
              <td>{{ ingredientFour }}</td>
              <td>{{ ingredientFive }}</td>
            </tr>
          </table>
          <table>
            <tr>
              <th>成份6</th>
              <th>成份7</th>
              <th>成份8</th>
              <th>成份9</th>
              <th>成份10</th>
            </tr>
            <tr>
              <td>{{ ingredientSix }}</td>
              <td>{{ ingredientSeven }}</td>
              <td>{{ ingredientEight }}</td>
              <td>{{ ingredientNine }}</td>
              <td>{{ ingredientTen }}</td>
            </tr>
          </table>
          <table>
            <tr>
              <th>成份11</th>
              <th>成份12</th>
              <th>成份13</th>
              <th>成份14</th>
              <th>成份15</th>
            </tr>
            <tr>
              <td>{{ ingredientEleven }}</td>
              <td>{{ ingredientTwelve }}</td>
              <td>{{ ingredientThirteen }}</td>
              <td>{{ ingredientFourteen }}</td>
              <td>{{ ingredientFifteen }}</td>
            </tr>
          </table>
          <table>
            <tr>
              <th>成份16</th>
              <th>成份17</th>
              <th>成份18</th>
              <th>成份19</th>
              <th>成份20</th>
            </tr>
            <tr>
              <td>{{ ingredientSixteen }}</td>
              <td>{{ ingredientSeventeen }}</td>
              <td>{{ ingredientEighteen }}</td>
              <td>{{ ingredientNineteen }}</td>
              <td>{{ ingredientTwenty }}</td>
            </tr>
          </table>
          <table>
            <tr>
              <th>成份21</th>
              <th>成份22</th>
              <th>成份23</th>
              <th>成份24</th>
              <th>成份25</th>
            </tr>
            <tr>
              <td>{{ ingredientTwentyOne }}</td>
              <td>{{ ingredientTwentyTwo }}</td>
              <td>{{ ingredientTwentyThree }}</td>
              <td>{{ ingredientTwentyFour }}</td>
              <td>{{ ingredientTwentyFive }}</td>
            </tr>
          </table>
        </div>
        <div class="c-bottom">
          <div>
            <i
              style="color: #017aff; margin-right: 10px"
              class="el-icon-question"
            ></i>
            <p>说明：</p>
            <p style="color: #017aff">F2吊牌设定 F3洗涤图标设定</p>
          </div>
          <el-checkbox
            v-model="checkKindsNumberIngredient"
            style="float: right; margin-right: 15px"
            >成份明细见水唛</el-checkbox
          >
        </div>
      </div>
      <!-- 右边框 -->
      <div class="content2">
        <div class="c2_box1">
          <p>货号</p>
          <input v-model="kindsNumber" type="text" class="in" disabled />
          <p>助记码</p>
          <input v-model="mnemonicCode" type="text" class="in" disabled />
          <p>客户编码</p>
          <input
            :disabled="!checkCustomerTag"
            v-model="customerNo"
            type="text"
            class="in"
            style="width: 80px"
            @keyup.enter="searchCustomer"
          />
          <el-select
            :disabled="!checkCustomerTag"
            v-model="customerInfo"
            style="width: 140px; height: 30px; margin-left: 10px"
            @change="selectCustomer"
          >
            <el-option
              v-for="item in customerSelectList"
              :key="item.value + Math.random()"
              :label="item.label"
              :value="item.value"
            >
              <span style="float: left">{{ item.no }}</span>
              <span style="float: right">{{ item.label }}</span></el-option
            >
          </el-select>
          <el-checkbox class="tags_check" v-model="checkCustomerTag"
            >客户补标</el-checkbox
          >
          <el-checkbox class="tags_check" v-model="versionRoom"
            >版房专用</el-checkbox
          >
        </div>
        <div class="c2_box1">
          <p>新RFID</p>
          <input v-model="newRfid" type="text" class="in" />
          <p>原RFID</p>
          <input v-model="oldRfid" type="text" class="in" />
          <p>吊牌价</p>
          <input
            v-model="sellingPrice"
            type="text"
            class="in"
            style="width: 140px"
            disabled
          />
          <el-checkbox class="tags_check" v-model="isVip"
            >显示VIP价</el-checkbox
          >
          <input v-model="vipPrice" type="text" class="in" disabled />
        </div>
        <div class="c2_box1">
          <p>正价</p>
          <input v-model="sellingPriceOne" type="text" class="in" disabled />
          <p>售价2</p>
          <input v-model="sellingPriceTwo" type="text" class="in" disabled />
          <p>售价3</p>
          <input v-model="sellingPriceThree" type="text" class="in" disabled />
          <p>售价4</p>
          <input v-model="sellingPriceFour" type="text" class="in" disabled />
        </div>
        <div class="c2_box1">
          <p>洗标类型</p>
          <input v-model="washingType" type="text" class="in" disabled />
          <!-- <el-select v-model="washingType" style="width:160px;height:30px;margin-left:10px;">
          <el-option 
          v-for="item in washingTypeList" 
          :key="item.value" 
          :label="item.label" 
          :value="item.value">
          </el-option>
          </el-select> -->
          <p>洗涤图</p>
          <div class="washImg">
            <input v-model="WashingFigure_1" type="text" disabled />
            <input v-model="WashingFigure_2" type="text" disabled />
            <input v-model="WashingFigure_3" type="text" disabled />
            <input v-model="WashingFigure_4" type="text" disabled />
            <input v-model="WashingFigure_5" type="text" disabled />
            <input
              v-model="WashingFigure_6"
              type="text"
              disabled
              style="margin-right: 15px"
            />
          </div>
          <el-button
            :disabled="tag"
            :type="!tag ? 'primary' : ''"
            icon="el-icon-printer"
            @click="linePrint"
            >列印吊牌</el-button
          >
          <el-button
            :disabled="!tag"
            :type="tag ? 'primary' : ''"
            icon="el-icon-printer"
            >列印洗标</el-button
          >
          <el-button @click="changeBid" icon="el-icon-refresh"
            >货号换标</el-button
          >
        </div>
        <div class="connect">
          <div>
            选择打印机：
            <el-select
              v-model="printAddress"
              @change="chosePrinter"
              style="width: 180px; height: 30px"
            >
              <el-option
                v-for="item in printerList"
                :key="item.value + Math.random()"
                :label="item.label"
                :value="item.value"
              ></el-option>
            </el-select>
            打印后台IP：
            <el-input style="width: 180px" v-model="printIp" disabled></el-input
            >&nbsp;
            <el-input
              style="width: 75px"
              v-model="printPort"
              disabled
            ></el-input
            >&nbsp;
            <el-button
              @click="connect"
              style="margin-right: 10px"
              :disabled="!printIp"
              >连线</el-button
            >
            打印机类型
            <el-select
              v-model="printerType"
              @change="
                () => {
                  this.tagsData = []
                  this.getPrintList()
                }
              "
              style="width: 100px; height: 30px"
            >
              <el-option
                v-for="item in printerTypeList"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              ></el-option>
            </el-select>
          </div>
          <div class="dyState">
            <!-- <input type='button' value='获取状态' @click='getStatus()' />-->
            打印机状态：
            <!-- <input type="text" name="status" id="status" value="未连接" readonly="readonly" />-->
            <el-input
              style="width: 180px; margin: 0 3px 0 5px"
              name="status"
              id="status"
              value="未连接"
              readonly="readonly"
            ></el-input>
            <div
              :style="{ display: userId == '1125681210' ? 'block' : 'none' }"
            >
              <!--固定账号下 子账号同为一个 userId-->
              选择打印品牌：
              <el-select
                v-model="brandType"
                style="width: 100px; height: 30px; margin-right: 10px"
              >
                <el-option
                  v-for="item in typeList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                ></el-option>
              </el-select>
              <el-checkbox v-model="chose">打印地址</el-checkbox>
            </div>
          </div>
        </div>
        <div class="content_tab2">
          <el-table
            border
            :data="tagsData"
            @row-click="rowClick"
            style="width: 100%; margin-bottom: 20px"
            height="300px"
            :header-cell-style="{
              background: '#f4f4f4',
              padding: 0,
              height: '40px'
            }"
            :cell-style="{ padding: 0, height: '36px' }"
          >
            <el-table-column
              prop="kindsNumbers"
              width="135"
              label="货号"
            ></el-table-column>
            <el-table-column
              prop="sellingPrice"
              label="吊牌价"
            ></el-table-column>
            <el-table-column
              sortable
              prop="sizeNo"
              label="尺码编码"
            ></el-table-column>
            <el-table-column prop="number" label="张数">
              <template slot-scope="scope">
                <el-input
                  v-model="scope.row.number"
                  @blur="leaveNum(scope.row)"
                  @input="$forceUpdate()"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column
              prop="finishNumber"
              label="已打张数"
            ></el-table-column>
            <el-table-column
              prop="mnemonicCode"
              label="助记码"
            ></el-table-column>
          </el-table>
        </div>
        <span>添加款号</span>
        <input
          v-model="addStyleNumber"
          type="text"
          class="in"
          style="margin-right: 10px"
        />
        <el-button @click="getPrintList" type="primary">获取打印列表</el-button>
        <div class="last" style="margin-top: 10px; float: right">
          <i
            style="color: #017aff; margin: 4px 20px 0 0"
            class="el-icon-question"
          ></i>
          <p style="width: auto">打印张数：{{ amount }}</p>
        </div>
      </div>
    </div>
    <set-para
      :style="{ display: showParameter }"
      @closeParameter="closeParameter"
      @change="change"
    ></set-para>
    <icon-doc
      :style="{ display: showIconDoc }"
      @closeIconDoc="closeIconDoc"
    ></icon-doc>
    <foot-view class="footView">
      <div slot="text">
        <span>数据库：{{ jxQuarter }}</span>
      </div>
    </foot-view>
    <div id="p" v-show="false"></div>
  </div>
</template>

<script>
var wsocket = {}
var totalNum
var retryGet
var TID
import setPara from './childComps/setPara'
import iconDoc from './childComps/iconDoc'
import footView from '../../../components/FootView'
import { getArtNo } from '../../../network/artNo'
import {
  barcodeWashPrint,
  washPrintLinePrint,
  removeRedis,
  getWashdata,
  getRfid,
  changeBID,
  sendNum,
  getPrinterParameter,
  postPrinterParameter
} from '../../../network/tags'
import { getClient } from '../../../network/client'
import enterUp from '../../../components/mixins/enterUp'
import printLabel from '../../../components/mixins/printLabel'

export default {
  name: 'tags1',
  mixins: [enterUp, printLabel],
  data() {
    return {
      addStyleNumber: '',
      chose: false,
      userId: document.cookie.match(
        RegExp('jxSoftWareCustomerId' + '=([^;]+)')
      )[1],
      brandType: '无logo',
      typeList: [
        { value: '袜子', label: '袜子' },
        { value: '風姿田', label: '風姿田' },
        { value: 'KS99', label: 'KS99' },
        { value: '无logo', label: '无logo' }
      ],
      loading: {},
      allSizeMap: {
        c05: 'XS',
        c07: 'S',
        c09: 'M',
        c11: 'L',
        c13: 'XL',
        c15: '2L',
        c17: '3L',
        c19: '4L',
        c21: '5L',
        c23: '6L',
        f: 'F'
      },
      dataList: [],
      printerList: [],
      printAddress: '',
      printIp: '',
      printPort: '',
      inpList: [],
      kl: [],
      // printIp:'192.168.3.150',
      // printIp:'jiaxinoy.oicp.net',
      // jxQuarter: document.cookie.match(RegExp('jxQuarter' + '=([^;]+)'))[1],
      jxQuarter:null,
      tData: [],
      LData: [],
      lb: 'B类(可直接接触皮肤)',
      address: '广州',
      allContent: '',
      RidList: [],

      dyList: [],

      contener: [],
      dport: '',
      temperature: '',
      speed: '',
      lefts: '',
      top: '',
      xbPort: '',
      xbTemperature: '',
      xbSpeed: '',
      xbLeft: '',
      xbTop: '',
      rotate: '',
      direction: '',

      tag: false,

      // 控制显示弹窗
      showParameter: 'none',
      showIconDoc: 'none',

      styleNumber: '',
      colorNo: '',
      color: '',
      otherColor: '',
      brandedName: '',
      commodityName: '',
      city: '广州',
      area: [
        {
          value: '广州',
          label: '广州'
        },
        {
          value: '深圳',
          label: '深圳'
        },
        {
          value: '香港',
          label: '香港'
        },
        {
          value: '台湾',
          label: '台湾'
        }
      ],
      alternatives: false,
      standard: '',
      accessoryName: '',
      size: '',
      otherSize: '',
      matchStyle: '',
      safetyType: '',
      isIncludeMetalFibre: '',
      downcontent: '',
      fillcontent: '',
      ean13No: '',
      operator: '',
      changeOperator: false,

      ingredientOne: '',
      ingredientTwo: '',
      ingredientThree: '',
      ingredientFour: '',
      ingredientFive: '',
      ingredientSix: '',
      ingredientSeven: '',
      ingredientEight: '',
      ingredientNine: '',
      ingredientTen: '',
      ingredientEleven: '',
      ingredientTwelve: '',
      ingredientThirteen: '',
      ingredientFourteen: '',
      ingredientFifteen: '',
      ingredientSixteen: '',
      ingredientSeventeen: '',
      ingredientEighteen: '',
      ingredientNineteen: '',
      ingredientTwenty: '',
      ingredientTwentyOne: '',
      ingredientTwentyTwo: '',
      ingredientTwentyThree: '',
      ingredientTwentyFour: '',
      ingredientTwentyFive: '',
      checkKindsNumberIngredient: false,

      kindsNumber: '',
      mnemonicCode: '',
      customerList: [],
      customerNo: '',
      customerInfo: '',
      customerSelectList: [],
      checkCustomerTag: false,
      versionRoom: false,
      newRfid: '',
      oldRfid: '',
      sellingPrice: '',
      isVip: false,
      vipPrice: '',
      sellingPriceOne: '',
      sellingPriceTwo: '',
      sellingPriceThree: '',
      sellingPriceFour: '',
      washingType: '',
      WashingFigure_1: '',
      WashingFigure_2: '',
      WashingFigure_3: '',
      WashingFigure_4: '',
      WashingFigure_5: '',
      WashingFigure_6: '',

      index: '',
      tagsData: [],
      aka: [],

      state: '',

      // 总打印张数
      amount: 0,

      printerType: 0,
      printerTypeList: [
        { value: 0, label: 'ZMIN' },
        { value: 1, label: 'TSC' }
      ],

      printColorMap: {},
      printSizeMap: {}
    }
  },
  watch: {
    brandType(a, b) {
      if (a == '袜子') {
        this.printerType = 1
        this.tagsData = []
        this.getPrintList()
      }
    },
    alternatives(a, b) {
      if (!a) {
        // this.city = ''
      }
    },
    changeOperator(a, b) {
      if (!a) {
        // this.operator = this.tagsData[this.index].kindsNumber.supplier
      }
    },
    checkKindsNumberIngredient(a, b) {
      for (let aa of this.tagsData) {
        if (this.checkKindsNumberIngredient == false) {
          this.ingredientOne = aa.kindsNumberIngredient.ingredientOne
          this.ingredientTwo = aa.kindsNumberIngredient.ingredientTwo
          this.ingredientThree = aa.kindsNumberIngredient.ingredientThree
          this.ingredientFour = aa.kindsNumberIngredient.ingredientFour
          this.ingredientFive = aa.kindsNumberIngredient.ingredientFive
          this.ingredientSix = aa.kindsNumberIngredient.ingredientSix
          this.ingredientSeven = aa.kindsNumberIngredient.ingredientSeven
          this.ingredientEight = aa.kindsNumberIngredient.ingredientEight
          this.ingredientNine = aa.kindsNumberIngredient.ingredientNine
          this.ingredientTen = aa.kindsNumberIngredient.ingredientTen
          this.ingredientEleven = aa.kindsNumberIngredient.ingredientEleven
          this.ingredientTwelve = aa.kindsNumberIngredient.ingredientTwelve
          this.ingredientThirteen = aa.kindsNumberIngredient.ingredientThirteen
          this.ingredientFourteen = aa.kindsNumberIngredient.ingredientFourteen
          this.ingredientFifteen = aa.kindsNumberIngredient.ingredientFifteen
          this.ingredientSixteen = aa.kindsNumberIngredient.ingredientSixteen
          this.ingredientSeventeen =
            aa.kindsNumberIngredient.ingredientSeventeen
          this.ingredientEighteen = aa.kindsNumberIngredient.ingredientEighteen
          this.ingredientNineteen = aa.kindsNumberIngredient.ingredientNineteen
          this.ingredientTwenty = aa.kindsNumberIngredient.ingredientTwenty
          this.ingredientTwentyOne =
            aa.kindsNumberIngredient.ingredientTwentyOne
          this.ingredientTwentyTwo =
            aa.kindsNumberIngredient.ingredientTwentyTwo
          this.ingredientTwentyThree =
            aa.kindsNumberIngredient.ingredientTwentyThree
          this.ingredientTwentyFour =
            aa.kindsNumberIngredient.ingredientTwentyFour
          this.ingredientTwentyFive =
            aa.kindsNumberIngredient.ingredientTwentyFive
        } else if (this.checkKindsNumberIngredient == true) {
          this.ingredientOne = ''
          this.ingredientTwo = ''
          this.ingredientThree = ''
          this.ingredientFour = ''
          this.ingredientFive = ''
          this.ingredientSix = ''
          this.ingredientSeven = ''
          this.ingredientEight = ''
          this.ingredientNine = ''
          this.ingredientTen = ''
          this.ingredientEleven = ''
          this.ingredientTwelve = ''
          this.ingredientThirteen = ''
          this.ingredientFourteen = ''
          this.ingredientFifteen = ''
          this.ingredientSixteen = ''
          this.ingredientSeventeen = ''
          this.ingredientEighteen = ''
          this.ingredientNineteen = ''
          this.ingredientTwenty = ''
          this.ingredientTwentyOne = ''
          this.ingredientTwentyTwo = ''
          this.ingredientTwentyThree = ''
          this.ingredientTwentyFour = ''
          this.ingredientTwentyFive = ''
        }
      }
    }
  },
  components: {
    setPara,
    iconDoc,
    footView
  },
  methods: {
    //该检验员
    leaveOperator() {
      for (let j of this.tagsData) {
        if (this.styleNumber == j.kindsNumber.styleNumber) {
          j.kindsNumber.supplier = this.operator
        }
        console.log(j.kindsNumber.supplier)
      }
    },
    //选条码机
    chosePrinter() {
      console.log(this.dataList)
      console.log(wsocket.readyState)
      for (let p of this.dataList) {
        if (this.printAddress == p.printAddress) {
          this.printIp = p.printIp
          this.printPort = p.printPort
          if (wsocket.readyState == 1) wsocket.close()
        }
      }
    },
    //打印机参数
    _getPrintData() {
      getPrinterParameter().then((res) => {
        console.log(res.data)
        let data = res.data.data
        this.dataList = res.data.data
        this.printerList = []
        data.forEach((e) => {
          this.printerList.push({
            label: e.printAddress,
            value: e.printAddress
          })
        })
        for (let n of data) {
          ;(this.dport = String(n.port)),
            (this.temperature = String(n.temperature)),
            (this.speed = n.speed),
            (this.lefts = n.lefts),
            (this.top = n.top)
        }
      })
    },
    leaveNum(row) {
      let result = row.number || 0
      let r = /^\+?[1-9][0-9]*$/
      if (result != 0) {
        result = result.replace(/\b(0+)/gi, '')
      }
      if (!r.test(result) && result) {
        this.$message.info('数量请输入正整数')
        row.number = 0
        this.$forceUpdate()
        return
      }
      this.amount = 0
      this.tagsData.forEach((e) => {
        this.amount += Number(e.number == undefined ? 0 : e.number)
      })
    },
    connect() {
      this.connection()
      localStorage.setItem('connectData', [
        this.printAddress,
        this.printIp,
        this.printPort
      ])
    },
    //货号换标
    changeBid() {
      if (this.newRfid == '' || this.oldRfid == '') {
        this.$message({
          type: 'error',
          message: '新旧RFID不能为空'
        })
        return
      }
      let params = {
        newRfid: this.newRfid,
        oldRfid: this.oldRfid
      }
      console.log(params)
      changeBID(params).then((res) => {
        console.log(res.data)
      })
    },
    // 打印表点击一行
    rowClick(e) {
      this.alternatives = false
      this.newRfid = ''
      this.oldRfid = ''
      this.customerNo = ''
      this.customerInfo = ''
      this.checkCustomerTag = false
      this.versionRoom = false
      // this.isVip = false
      // this.index = e.$rowIndex
      // let element = e.data[this.index]
      // let kindsNumberIngredient = e.data[this.index].kindsNumberIngredient

      this.styleNumber = e.kindsNumber.styleNumber
      this.colorNo = e.colorNo
      this.color = e.colorName
      this.kindsNumber = e.kindsNumbers
      this.mnemonicCode = e.mnemonicCode
      this.sellingPrice = e.sellingPrice

      for (let aa of this.tagsData) {
        if (this.styleNumber == aa.kindsNumber.styleNumber) {
          if (aa.kindsNumberIngredient != null) {
            this.standard = aa.kindsNumberIngredient.standard //标准
            this.safetyType = aa.kindsNumberIngredient.safetyType //安全类别
            this.isIncludeMetalFibre =
              aa.kindsNumberIngredient.isIncludeMetalFibre //金属纤维
            this.ean13No = aa.kindsNumberIngredient.ean13No
            // this.operator = aa.kindsNumberIngredient.operator
            this.ingredientOne = aa.kindsNumberIngredient.ingredientOne
            this.ingredientTwo = aa.kindsNumberIngredient.ingredientTwo
            this.ingredientThree = aa.kindsNumberIngredient.ingredientThree
            this.ingredientFour = aa.kindsNumberIngredient.ingredientFour
            this.ingredientFive = aa.kindsNumberIngredient.ingredientFive
            this.ingredientSix = aa.kindsNumberIngredient.ingredientSix
            this.ingredientSeven = aa.kindsNumberIngredient.ingredientSeven
            this.ingredientEight = aa.kindsNumberIngredient.ingredientEight
            this.ingredientNine = aa.kindsNumberIngredient.ingredientNine
            this.ingredientTen = aa.kindsNumberIngredient.ingredientTen
            this.ingredientEleven = aa.kindsNumberIngredient.ingredientEleven
            this.ingredientTwelve = aa.kindsNumberIngredient.ingredientTwelve
            this.ingredientThirteen =
              aa.kindsNumberIngredient.ingredientThirteen
            this.ingredientFourteen =
              aa.kindsNumberIngredient.ingredientFourteen
            this.ingredientFifteen = aa.kindsNumberIngredient.ingredientFifteen
            this.ingredientSixteen = aa.kindsNumberIngredient.ingredientSixteen
            this.ingredientSeventeen =
              aa.kindsNumberIngredient.ingredientSeventeen
            this.ingredientEighteen =
              aa.kindsNumberIngredient.ingredientEighteen
            this.ingredientNineteen =
              aa.kindsNumberIngredient.ingredientNineteen
            this.ingredientTwenty = aa.kindsNumberIngredient.ingredientTwenty
            this.ingredientTwentyOne =
              aa.kindsNumberIngredient.ingredientTwentyOne
            this.ingredientTwentyTwo =
              aa.kindsNumberIngredient.ingredientTwentyTwo
            this.ingredientTwentyThree =
              aa.kindsNumberIngredient.ingredientTwentyThree
            this.ingredientTwentyFour =
              aa.kindsNumberIngredient.ingredientTwentyFour
            this.ingredientTwentyFive =
              aa.kindsNumberIngredient.ingredientTwentyFive
            this.washingType = aa.kindsNumberIngredient.washingType
            this.WashingFigure_1 = aa.kindsNumberIngredient.imageOne
            this.WashingFigure_2 = aa.kindsNumberIngredient.imageTwo
            this.WashingFigure_3 = aa.kindsNumberIngredient.imageThree
            this.WashingFigure_4 = aa.kindsNumberIngredient.imageFour
            this.WashingFigure_5 = aa.kindsNumberIngredient.imageFive
            this.WashingFigure_6 = aa.kindsNumberIngredient.imageSix
          } else if (aa.kindsNumberIngredient == null) {
            break
          }
          this.operator = aa.kindsNumber.supplier
          this.commodityName = aa.kindsNumber.commodityName
          this.brandedName = aa.kindsNumber.brandedName
          this.sellingPriceOne = aa.kindsNumber.sellingPriceOne
          this.sellingPriceTwo = aa.kindsNumber.sellingPriceTwo
          this.sellingPriceThree = aa.kindsNumber.sellingPriceThree
          this.sellingPriceFour = aa.kindsNumber.sellingPriceFour
          this.accessoryName = aa.kindsNumber.accessoryName //附件
          this.size = aa.kindsNumber.size
          this.matchStyle = aa.kindsNumber.matchStyle //搭配款
          if (this.isVip == true) {
            this.vipPrice = aa.kindsNumber.vipPrice
          } else if (this.isVip == false) {
            this.vipPrice = ''
          }

          if (aa.otherSizeSet != null) {
            this.otherSize = aa.otherSizeSet.join('')
          }
          if (aa.otherColorSet != null) {
            this.otherColor = aa.otherColorSet.join('')
          }

          if (aa.feather != null) {
            this.downcontent = aa.feather.includeFeather //含绒量
            this.fillcontent = aa.feather.sufficientFeather //充绒量
          } else {
            break
          }

          // customerNo
        }
      }
    },
    closeParameter() {
      this.showParameter = 'none'
    },
    closeIconDoc() {
      this.showIconDoc = 'none'
    },
    // 选择客户
    selectCustomer(e) {
      for (const i of this.customerList) {
        if (i.name == e) {
          this.customerNo = i.no
          this.customerInfo = i.name
          return
        }
      }
    },
    // 输入客户编号
    searchCustomer(e) {
      e.target.blur()
      for (const i of this.customerList) {
        if (this.customerNo == i.no) {
          this.customerInfo = i.name
          return
        }
      }
      this.$message({
        type: 'error',
        message: '无此客户编号!'
      })
    },

    change(data) {
      ;(this.dport = String(data.port)),
        (this.temperature = String(data.temperature)),
        (this.speed = data.speed),
        (this.lefts = data.lefts),
        (this.top = data.top),
        (this.xbPort = data.xbPort),
        (this.xbTemperature = data.xbTemperature),
        (this.xbSpeed = data.xbSpeed),
        (this.xbLeft = data.xbLeft),
        (this.xbTop = data.xbTop),
        (this.rotate = data.rotate == 0 ? 'B' : 'T')
      console.log(typeof this.temperature, typeof this.dport)
      postPrinterParameter(data).then((res) => {
        console.log(res)
        if (res.data.code == 200) {
          this.$message({
            type: 'success',
            message: '保存成功'
          })
          this._getPrintData()
        }
      })

      this.showParameter = 'none'
    },

    //连接打印后台
    connection() {
      var wsserver = 'wss://' + this.printIp + ':' + this.printPort + '/'
      if ('WebSocket' in window) {
        wsocket = new WebSocket(wsserver)
      } else if ('MozWebSocket' in window) {
        wsocket = new MozWebSocket(wsserver)
      } else {
        alert('不支持当前浏览器！')
      }

      //注册各类回调
      wsocket.onopen = function () {
        document.getElementById('status').value = '连接打印后台成功！'
        //wsocket.send('我是客户端，我准备好了。'); //给服务器发送消息
      }

      wsocket.onclose = function (event) {
        document.getElementById('status').value = '与打印后台断开连接！' //状态
      }

      wsocket.onerror = function () //出错的提示
      {
        //alert('数据传输错误！');
        console.log(1, this.kl)
      }

      wsocket.onmessage = function (receiveMsg) {
        //alert('有新消息！');

        document.getElementById('status').value = receiveMsg.data //显示服务器传回6的消息
        console.log(receiveMsg.data)
        // alert(receiveMsg.data)
        this.state = receiveMsg.data
      }
    },

    linePrint() {
      //向打印后台发送消息
      if (this.tagsData == '' || this.tagsData == null) {
        this.$message({
          type: 'warning',
          message: '请先获取打印列表'
        })
        return
      }
      let printList = []
      this.tagsData.forEach((e) => {
        if (e.number) {
          printList.push(e)
        }
      })
      if (this.printerType) {
        if (this.amount) {
          // console.log(new Date().getTime())
          // this.loading = this.$loading({
          //   lock: true,
          //   text: '打印准备中...',
          //   spinner: 'el-icon-loading',
          //   background: 'rgba(0, 0, 0, 0)'
          // });
          switch (this.brandType) {
            case '袜子':
              this.socksLabel(printList)
              break
            default:
              this.tscPrint(printList)
              break
          }
          // console.log(new Date().getTime())
          // this.loading.close()
        }
        return
      }

      var au = []
      var ai = []
      var ak = {}
      this.LData = []
      for (let u of this.tagsData) {
        if (u.number) {
          ak[u.kindsNumbers] = u.number
        }

        for (let t = 0; t < u.number; t++) {
          this.LData.push(u)
        }
      }

      console.log(ak)

      this.dyList = JSON.parse(
        JSON.stringify(this.LData)
      ) /*數組有__ob__: Observer不可被選取值 轉JSON*/

      getRfid(ak).then((res) => {
        this.RidList = res.data.data
        console.log(res.data)
        if (res.data.code == 200 && res.data.data != null) {
          for (var vc in this.dyList) {
            for (var ve in this.RidList) {
              if (
                vc == ve &&
                this.dyList[vc].kindsNumbers == this.RidList[ve].kindsNumber
              ) {
                this.dyList[vc]['rFID'] = this.RidList[ve].id
                this.dyList[vc]['sixID'] = this.RidList[ve].showCode
                this.dyList[vc]['showMap'] = this.RidList[ve]
              }
            }
          }
          console.log(this.dyList)
          // totalNum = 1;  //打印总张数; 180809
          totalNum = Number(this.amount)
          retryGet = 2 //获取出错时,重试次数;  180810
          totalNum--
          // wsocket.send('ZM_ReadRFTagDataUSB|255|0|15|0|' + TID + '|3000');// //wsocket.send('ZM_HF_GetTagInfo|0|1|0|0|0|0|null|2000');//读取UID,已经带Openport(255)

          this.printlabel('12345678901234') //单独打印测试
          let params1 = {
            rfidList: this.kl,
            customerNo: this.customerNo,
            checkCustomerTag: this.checkCustomerTag
          }
          console.log(params1)
          sendNum(JSON.stringify(params1)).then((res) => {
            console.log(res.data)
            if (res.data.code == 200) {
              // this.$router.go(0)
              wsocket.send('ZM_ClearBuffer') //清空
            }
          })
        } else {
          this.$message.error({
            message: '打印失败，请重试'
          })
        }
      })
    },
    // 字的位置不再标签上 会导致打印机没反应
    printlabel(TIDCode) {
      var LIList = JSON.parse(JSON.stringify(this.dyList))
      console.log(LIList)
      var imagebase64
      if (this.userId == '1125681210') {
        if (this.brandType == '風姿田') {
          imagebase64 =
            ''
        } else if (this.brandType == 'KS99') {
          imagebase64 =
            ''
        }
        if (this.brandType != '无logo') {
          if (this.chose == false) {
            //打印logo不打印地址
            for (let cd of LIList) {
              if (cd.number == '' || cd.number == undefined) {
                break
              }
              wsocket.send('OpenPort|' + this.dport + '') //打开端口
              wsocket.send('ZM_ClearBuffer') //清空
              wsocket.send('ZM_SetDirection|' + this.rotate) //設置打印方向
              wsocket.send('ZM_SetPrintSpeed|' + this.speed) //设置速度
              wsocket.send('ZM_SetDarkness|' + this.temperature) //设置温度
              wsocket.send('ZM_SetLabelHeight|368|24') //设置标签高度和间隙 ; [200dpi] 1mm = 8 dot; [300dpi] 1mm=12dot;
              wsocket.send('ZM_SetLabelWidth|780') //设置标签宽度;  [200dpi] 1mm = 8 dot; [300dpi] 1mm=12dot;

              wsocket.send('PrintBase64Image|620|75|' + imagebase64) //打印图片
              wsocket.send(
                'ZM_DrawTextTrueTypeW|720|130|38|0|宋体|4|900|0|0|0|M0|合格证'
              )
              wsocket.send(
                'ZM_DrawTextTrueTypeW|610|40|26|0|宋体|4|700|0|0|0|M1|款号: '
              )
              wsocket.send(
                'ZM_DrawTextTrueTypeW|610|95|28|0|黑体|4|800|0|0|0|E2|' +
                  cd.kindsNumber.styleNumber +
                  ''
              )

              wsocket.send(
                'ZM_DrawTextTrueTypeW|580|40|26|0|宋体|4|700|0|0|0|E0|' +
                  '尺码:' +
                  cd.sizeNo.split('-')[1] +
                  ''
              )
              if (cd.sizeNumberType != null) {
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|580|120|26|0|宋体|4|700|0|0|0|E1|' +
                    `(${cd.sizeNumberType})` +
                    ''
                )
              }
              wsocket.send(
                'ZM_DrawTextTrueTypeW|550|40|26|0|宋体|4|700|0|0|0|E4|' +
                  '颜色:' +
                  cd.colorNo +
                  '   ' +
                  cd.colorName +
                  ''
              )
              wsocket.send(
                'ZM_DrawTextTrueTypeW|520|40|26|0|宋体|4|700|0|0|0|E5|' +
                  '品名:' +
                  cd.kindsNumber.commodityName +
                  ''
              )
              wsocket.send(
                'ZM_DrawTextTrueTypeW|490|40|26|0|宋体|4|700|0|0|0|E6|等级:合格品'
              )
              wsocket.send(
                'ZM_DrawTextTrueTypeW|490|180|26|0|宋体|4|700|0|0|0|E7|' +
                  '检验员:' +
                  cd.kindsNumber.supplier +
                  ''
              ) //检验员
              if (this.checkKindsNumberIngredient == false) {
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|460|40|26|0|宋体|4|700|0|0|0|B5|' +
                    cd.kindsNumberIngredient.ingredientOne +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|435|40|26|0|宋体|4|700|0|0|0|B6|' +
                    cd.kindsNumberIngredient.ingredientTwo +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|410|40|26|0|宋体|4|700|0|0|0|B7|' +
                    cd.kindsNumberIngredient.ingredientThree +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|385|40|26|0|宋体|4|700|0|0|0|B8|' +
                    cd.kindsNumberIngredient.ingredientFour +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|360|40|26|0|宋体|4|700|0|0|0|B9|' +
                    cd.kindsNumberIngredient.ingredientFive +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|335|40|26|0|宋体|4|700|0|0|0|C0|' +
                    cd.kindsNumberIngredient.ingredientSix +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|310|40|26|0|宋体|4|700|0|0|0|C1|' +
                    cd.kindsNumberIngredient.ingredientSeven +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|285|40|26|0|宋体|4|700|0|0|0|C2|' +
                    cd.kindsNumberIngredient.ingredientEight +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|260|40|26|0|宋体|4|700|0|0|0|C3|' +
                    cd.kindsNumberIngredient.ingredientNine +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|235|40|26|0|宋体|4|700|0|0|0|C4|' +
                    cd.kindsNumberIngredient.ingredientTen +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|210|40|26|0|宋体|4|700|0|0|0|C5|' +
                    cd.kindsNumberIngredient.ingredientEleven +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|185|40|26|0|宋体|4|700|0|0|0|G3|' +
                    cd.kindsNumberIngredient.ingredientTwelve +
                    ''
                )
              } else {
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|460|40|26|0|宋体|4|700|0|0|0|D5|成份明细见水唛'
                )
              }
              wsocket.send(
                'ZM_DrawTextTrueTypeW|175|40|26|0|宋体|4|700|0|0|0|B1|' +
                  '执行标准:' +
                  cd.kindsNumberIngredient.standard +
                  ''
              )
              wsocket.send(
                'ZM_DrawTextTrueTypeW|145|38|22|0|宋体|4|700|0|0|0|B2|' +
                  '安全技术类别:' +
                  cd.kindsNumberIngredient.safetyType +
                  ''
              )
              if (cd.kindsNumberIngredient.safetyType != '') {
                if (
                  cd.kindsNumberIngredient.safetyType.substring(
                    cd.kindsNumberIngredient.safetyType.length - 2
                  ) == 'B类'
                ) {
                  wsocket.send(
                    'ZM_DrawTextTrueTypeW|120|80|26|0|宋体|4|700|0|0|0|B1|' +
                      '(直接接触皮肤类)'
                  )
                } else {
                  wsocket.send(
                    'ZM_DrawTextTrueTypeW|120|80|26|0|宋体|4|700|0|0|0|B1|' +
                      '(非直接接触皮肤类)'
                  )
                }
              } //获取字符串最后两位
              // wsocket.send('ZM_DrawBarcode|165|40|1|1|1|2|40|N|' + cd.kindsNumbers +'');//货号一维码
              // wsocket.send('ZM_DrawTextTrueTypeW|120|40|28|0|黑体|4|800|0|0|0|A1|' + '货号码: ' + cd.kindsNumbers +'');
              wsocket.send(
                'ZM_DrawTextTrueTypeW|85|40|36|0|宋体|4|900|0|0|0|C9|' +
                  '零售价：'
              )
              wsocket.send(
                'ZM_DrawTextTrueTypeW|90|180|46|0|Arial|4|900|0|0|0|D9|' +
                  cd.kindsNumber.sellingPrice +
                  '.00'
              )
              console.log(cd.sixID, cd.kindsNumbers)
              wsocket.send(
                'ZM_DrawBarcode|65|325|0|1|1|2|40|66|' + cd.sixID + ''
              )
              wsocket.send(
                'ZM_DrawTextTrueTypeW|170|345|24|0|宋体|1|900|0|0|0|D0|' +
                  cd.sixID +
                  ''
              )
              wsocket.send(
                'ZM_DrawBarcode|550|325|0|1|1|2|40|N|' + cd.kindsNumbers + ''
              ) //货号一维码  横向
              // //写卡 //向 EPC 区，写入数据格式为 16 进制的数据,共写入 12 个字节的数据："313030333731363045424151"
              wsocket.send('ZM_RW_RfidFormat|1|0|0|12|1|' + cd.rFID + '')
              console.log(typeof cd.rFID)
              //校验1
              wsocket.send('ZM_SetRFTagRetryCount|1|')
              //校验2
              wsocket.send('ZM_SetRFIDPosition|0|0|0|2|0|')
              wsocket.send('ZM_PrintLabel|1|1') //打印标签
              //设置密码
              // wsocket.send('ZM_SetRFTagPassWLock|1|2|FF123654|');
              wsocket.send('ClosePort') //关闭端口
              console.log('端口關閉')
              var date = new Date()
              var curDate = null
              do {
                curDate = new Date()
              } while (curDate - date < 3000)

              console.log(this.state)
              if (this.state == 0) {
                this.kl.push(cd.showMap)
              } else {
                return
              }
            }
          } else {
            //打印logo 打印地址
            for (let cd of LIList) {
              if (cd.number == '' || cd.number == undefined) {
                break
              }
              wsocket.send('OpenPort|' + this.dport + '') //打开端口
              wsocket.send('ZM_ClearBuffer') //清空
              wsocket.send('ZM_SetDirection|' + this.rotate) //設置打印方向
              wsocket.send('ZM_SetPrintSpeed|' + this.speed) //设置速度
              wsocket.send('ZM_SetDarkness|' + this.temperature) //设置温度
              wsocket.send('ZM_SetLabelHeight|368|24') //设置标签高度和间隙 ; [200dpi] 1mm = 8 dot; [300dpi] 1mm=12dot;
              wsocket.send('ZM_SetLabelWidth|780') //设置标签宽度;  [200dpi] 1mm = 8 dot; [300dpi] 1mm=12dot;

              wsocket.send('PrintBase64Image|620|75|' + imagebase64) //打印图片
              wsocket.send(
                'ZM_DrawTextTrueTypeW|720|130|38|0|宋体|4|900|0|0|0|M0|合格证'
              )
              wsocket.send(
                'ZM_DrawTextTrueTypeW|610|40|26|0|宋体|4|700|0|0|0|M1|款号: '
              )
              wsocket.send(
                'ZM_DrawTextTrueTypeW|610|95|28|0|黑体|4|800|0|0|0|E2|' +
                  cd.kindsNumber.styleNumber +
                  ''
              )

              wsocket.send(
                'ZM_DrawTextTrueTypeW|580|40|26|0|宋体|4|700|0|0|0|E0|' +
                  '尺码:' +
                  cd.sizeNo.split('-')[1] +
                  ''
              )
              if (cd.sizeNumberType != null) {
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|580|120|26|0|宋体|4|700|0|0|0|E1|' +
                    `(${cd.sizeNumberType})` +
                    ''
                )
              }
              wsocket.send(
                'ZM_DrawTextTrueTypeW|550|40|26|0|宋体|4|700|0|0|0|E4|' +
                  '颜色:' +
                  cd.colorNo +
                  '   ' +
                  cd.colorName +
                  ''
              )
              wsocket.send(
                'ZM_DrawTextTrueTypeW|520|40|26|0|宋体|4|700|0|0|0|E5|' +
                  '品名:' +
                  cd.kindsNumber.commodityName +
                  ''
              )
              wsocket.send(
                'ZM_DrawTextTrueTypeW|490|40|26|0|宋体|4|700|0|0|0|E6|等级:合格品'
              )
              wsocket.send(
                'ZM_DrawTextTrueTypeW|490|180|26|0|宋体|4|700|0|0|0|E7|' +
                  '检验员:' +
                  cd.kindsNumber.supplier +
                  ''
              ) //检验员
              if (this.checkKindsNumberIngredient == false) {
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|460|40|26|0|宋体|4|700|0|0|0|B5|' +
                    cd.kindsNumberIngredient.ingredientOne +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|435|40|26|0|宋体|4|700|0|0|0|B6|' +
                    cd.kindsNumberIngredient.ingredientTwo +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|410|40|26|0|宋体|4|700|0|0|0|B7|' +
                    cd.kindsNumberIngredient.ingredientThree +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|385|40|26|0|宋体|4|700|0|0|0|B8|' +
                    cd.kindsNumberIngredient.ingredientFour +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|360|40|26|0|宋体|4|700|0|0|0|B9|' +
                    cd.kindsNumberIngredient.ingredientFive +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|335|40|26|0|宋体|4|700|0|0|0|C0|' +
                    cd.kindsNumberIngredient.ingredientSix +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|310|40|26|0|宋体|4|700|0|0|0|C1|' +
                    cd.kindsNumberIngredient.ingredientSeven +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|285|40|26|0|宋体|4|700|0|0|0|C2|' +
                    cd.kindsNumberIngredient.ingredientEight +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|260|40|26|0|宋体|4|700|0|0|0|C3|' +
                    cd.kindsNumberIngredient.ingredientNine +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|235|40|26|0|宋体|4|700|0|0|0|C4|' +
                    cd.kindsNumberIngredient.ingredientTen +
                    ''
                )
                // wsocket.send('ZM_DrawTextTrueTypeW|210|40|26|0|宋体|4|700|0|0|0|C5|' + cd.kindsNumberIngredient.ingredientEleven +'');
              } else {
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|460|40|26|0|宋体|4|700|0|0|0|D5|成份明细见水唛'
                )
              }
              wsocket.send(
                'ZM_DrawTextTrueTypeW|250|40|26|0|宋体|4|700|0|0|0|B1|' +
                  '执行标准:' +
                  cd.kindsNumberIngredient.standard +
                  ''
              )
              wsocket.send(
                'ZM_DrawTextTrueTypeW|220|38|24|0|宋体|4|700|0|0|0|B2|' +
                  '安全技术类别:' +
                  cd.kindsNumberIngredient.safetyType +
                  ''
              )
              if (cd.kindsNumberIngredient.safetyType != '') {
                if (
                  cd.kindsNumberIngredient.safetyType.substring(
                    cd.kindsNumberIngredient.safetyType.length - 2
                  ) == 'B类'
                ) {
                  //获取字符串最后两位
                  wsocket.send(
                    'ZM_DrawTextTrueTypeW|190|80|26|0|宋体|4|700|0|0|0|B1|' +
                      '(直接接触皮肤类)'
                  )
                } else {
                  wsocket.send(
                    'ZM_DrawTextTrueTypeW|190|80|26|0|宋体|4|700|0|0|0|B1|' +
                      '(非直接接触皮肤类)'
                  )
                }
              }
              // wsocket.send('ZM_DrawTextTrueTypeW|120|40|28|0|黑体|4|800|0|0|0|A1|' + '货号码: ' + cd.kindsNumbers +'');
              wsocket.send(
                'ZM_DrawTextTrueTypeW|160|40|36|0|宋体|4|900|0|0|0|C9|' +
                  '零售价：'
              )
              wsocket.send(
                'ZM_DrawTextTrueTypeW|165|180|46|0|Arial|4|900|0|0|0|D9|' +
                  cd.kindsNumber.sellingPrice +
                  '.00'
              )
              //地址
              wsocket.send(
                'ZM_DrawTextTrueTypeW|120|40|23|0|宋体|4|700|0|0|0|G1|重庆瑞谷锦服饰有限责任公司'
              )
              wsocket.send(
                'ZM_DrawTextTrueTypeW|95|40|23|0|宋体|4|700|0|0|0|G2|工厂地址:重庆市回兴街道'
              )
              wsocket.send(
                'ZM_DrawTextTrueTypeW|70|40|23|0|宋体|4|700|0|0|0|G3|两港大道211号厂房6-1'
              )
              wsocket.send(
                'ZM_DrawTextTrueTypeW|45|40|23|0|宋体|4|700|0|0|0|G4|电话：023-67410336'
              )

              console.log(cd.sixID, cd.kindsNumbers)
              wsocket.send(
                'ZM_DrawBarcode|65|325|0|1|1|2|40|66|' + cd.sixID + ''
              )
              wsocket.send(
                'ZM_DrawTextTrueTypeW|170|345|24|0|宋体|1|900|0|0|0|D0|' +
                  cd.sixID +
                  ''
              )
              wsocket.send(
                'ZM_DrawBarcode|550|325|0|1|1|2|40|N|' + cd.kindsNumbers + ''
              ) //货号一维码  横向
              // //写卡 //向 EPC 区，写入数据格式为 16 进制的数据,共写入 12 个字节的数据："313030333731363045424151"
              wsocket.send('ZM_RW_RfidFormat|1|0|0|12|1|' + cd.rFID + '')
              console.log(typeof cd.rFID)
              //校验1
              wsocket.send('ZM_SetRFTagRetryCount|1|')
              //校验2
              wsocket.send('ZM_SetRFIDPosition|0|0|0|2|0|')
              wsocket.send('ZM_PrintLabel|1|1') //打印标签
              //设置密码
              // wsocket.send('ZM_SetRFTagPassWLock|1|2|FF123654|');
              wsocket.send('ClosePort') //关闭端口
              console.log('端口關閉')
              var date = new Date()
              var curDate = null
              do {
                curDate = new Date()
              } while (curDate - date < 3000)

              console.log(this.state)
              if (this.state == 0) {
                this.kl.push(cd.showMap)
              } else {
                return
              }
            }
          }
        } else {
          if (this.chose == false) {
            //打印无logo 不打印地址
            for (let cd of LIList) {
              if (cd.number == '' || cd.number == undefined) {
                break
              }
              wsocket.send('OpenPort|' + this.dport + '') //打开端口
              wsocket.send('ZM_ClearBuffer') //清空
              wsocket.send('ZM_SetDirection|' + this.rotate) //設置打印方向
              wsocket.send('ZM_SetPrintSpeed|' + this.speed) //设置速度
              wsocket.send('ZM_SetDarkness|' + this.temperature) //设置温度
              wsocket.send('ZM_SetLabelHeight|368|24') //设置标签高度和间隙 ; [200dpi] 1mm = 8 dot; [300dpi] 1mm=12dot;
              wsocket.send('ZM_SetLabelWidth|780') //设置标签宽度;  [200dpi] 1mm = 8 dot; [300dpi] 1mm=12dot;

              wsocket.send(
                'ZM_DrawTextTrueTypeW|720|130|38|0|宋体|4|900|0|0|0|M0|合格证'
              )
              wsocket.send(
                'ZM_DrawTextTrueTypeW|670|40|26|0|宋体|4|700|0|0|0|M1|款号: '
              )
              wsocket.send(
                'ZM_DrawTextTrueTypeW|670|95|28|0|黑体|4|800|0|0|0|E2|' +
                  cd.kindsNumber.styleNumber +
                  ''
              )

              wsocket.send(
                'ZM_DrawTextTrueTypeW|645|40|26|0|宋体|4|700|0|0|0|E0|' +
                  '尺码:' +
                  cd.sizeNo.split('-')[1] +
                  ''
              )
              if (cd.sizeNumberType != null) {
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|645|130|26|0|宋体|4|700|0|0|0|E1|' +
                    `(${cd.sizeNumberType})` +
                    ''
                )
              }

              wsocket.send(
                'ZM_DrawTextTrueTypeW|620|40|26|0|宋体|4|700|0|0|0|E4|' +
                  '颜色:' +
                  cd.colorNo +
                  '   ' +
                  cd.colorName +
                  ''
              )
              wsocket.send(
                'ZM_DrawTextTrueTypeW|595|40|26|0|宋体|4|700|0|0|0|E5|' +
                  '品名:' +
                  cd.kindsNumber.commodityName +
                  ''
              )
              wsocket.send(
                'ZM_DrawTextTrueTypeW|570|40|26|0|宋体|4|700|0|0|0|E6|等级:合格品'
              )
              wsocket.send(
                'ZM_DrawTextTrueTypeW|570|180|26|0|宋体|4|700|0|0|0|E7|' +
                  '检验员:' +
                  cd.kindsNumber.supplier +
                  ''
              ) //检验员
              // wsocket.send('ZM_DrawTextTrueTypeW|545|40|26|0|宋体|4|700|0|0|0|E8|面料:');
              if (this.checkKindsNumberIngredient == false) {
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|545|40|26|0|宋体|4|700|0|0|0|B5|' +
                    cd.kindsNumberIngredient.ingredientOne +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|520|40|26|0|宋体|4|700|0|0|0|B6|' +
                    cd.kindsNumberIngredient.ingredientTwo +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|495|40|26|0|宋体|4|700|0|0|0|B7|' +
                    cd.kindsNumberIngredient.ingredientThree +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|470|40|26|0|宋体|4|700|0|0|0|B8|' +
                    cd.kindsNumberIngredient.ingredientFour +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|445|40|26|0|宋体|4|700|0|0|0|B9|' +
                    cd.kindsNumberIngredient.ingredientFive +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|420|40|26|0|宋体|4|700|0|0|0|C0|' +
                    cd.kindsNumberIngredient.ingredientSix +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|395|40|26|0|宋体|4|700|0|0|0|C1|' +
                    cd.kindsNumberIngredient.ingredientSeven +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|370|40|26|0|宋体|4|700|0|0|0|C2|' +
                    cd.kindsNumberIngredient.ingredientEight +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|345|40|26|0|宋体|4|700|0|0|0|C3|' +
                    cd.kindsNumberIngredient.ingredientNine +
                    ''
                ) //取消换行显示
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|320|40|26|0|宋体|4|700|0|0|0|C4|' +
                    cd.kindsNumberIngredient.ingredientTen +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|295|40|26|0|宋体|4|700|0|0|0|C5|' +
                    cd.kindsNumberIngredient.ingredientEleven +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|270|40|26|0|宋体|4|700|0|0|0|G7|' +
                    cd.kindsNumberIngredient.ingredientTwelve +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|245|40|26|0|宋体|4|700|0|0|0|F1|' +
                    cd.kindsNumberIngredient.ingredientThirteen +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|220|40|26|0|宋体|4|700|0|0|0|F2|' +
                    cd.kindsNumberIngredient.ingredientFourteen +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|195|40|26|0|宋体|4|700|0|0|0|F3|' +
                    cd.kindsNumberIngredient.ingredientFifteen +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|170|40|26|0|宋体|4|700|0|0|0|F4|' +
                    cd.kindsNumberIngredient.ingredientSixteen +
                    ''
                )
              } else {
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|545|40|26|0|宋体|4|700|0|0|0|D5|成份明细见水唛'
                )
              }

              wsocket.send(
                'ZM_DrawTextTrueTypeW|170|40|26|0|宋体|4|700|0|0|0|B1|' +
                  '执行标准:' +
                  cd.kindsNumberIngredient.standard +
                  ''
              )
              wsocket.send(
                'ZM_DrawTextTrueTypeW|140|38|22|0|宋体|4|700|0|0|0|B2|' +
                  '安全技术类别:' +
                  cd.kindsNumberIngredient.safetyType +
                  ''
              )
              if (cd.kindsNumberIngredient.safetyType != '') {
                if (
                  cd.kindsNumberIngredient.safetyType.substring(
                    cd.kindsNumberIngredient.safetyType.length - 2
                  ) == 'B类'
                ) {
                  wsocket.send(
                    'ZM_DrawTextTrueTypeW|110|80|26|0|宋体|4|700|0|0|0|B1|' +
                      '(直接接触皮肤类)'
                  )
                } else {
                  wsocket.send(
                    'ZM_DrawTextTrueTypeW|110|80|26|0|宋体|4|700|0|0|0|B1|' +
                      '(非直接接触皮肤类)'
                  )
                }
              }
              // wsocket.send('ZM_DrawBarcode|165|40|1|1|1|2|40|N|' + cd.kindsNumbers +'');//货号一维码
              // wsocket.send('ZM_DrawTextTrueTypeW|120|40|28|0|黑体|4|800|0|0|0|A1|' + '货号码: ' + cd.kindsNumbers +'');
              wsocket.send(
                'ZM_DrawTextTrueTypeW|85|40|36|0|宋体|4|900|0|0|0|C9|' +
                  '零售价：'
              )
              wsocket.send(
                'ZM_DrawTextTrueTypeW|90|180|46|0|Arial|4|900|0|0|0|D9|' +
                  cd.kindsNumber.sellingPrice +
                  '.00'
              )
              console.log(cd.sixID, cd.kindsNumbers)
              wsocket.send(
                'ZM_DrawBarcode|65|325|0|1|1|2|40|66|' + cd.sixID + ''
              )
              wsocket.send(
                'ZM_DrawTextTrueTypeW|170|345|24|0|宋体|1|900|0|0|0|D0|' +
                  cd.sixID +
                  ''
              )
              wsocket.send(
                'ZM_DrawBarcode|550|325|0|1|1|2|40|N|' + cd.kindsNumbers + ''
              ) //货号一维码    横向
              // //写卡 //向 EPC 区，写入数据格式为 16 进制的数据,共写入 12 个字节的数据："313030333731363045424151"
              wsocket.send('ZM_RW_RfidFormat|1|0|0|12|1|' + cd.rFID + '')
              console.log(typeof cd.rFID)
              //校验1
              wsocket.send('ZM_SetRFTagRetryCount|1|')
              //校验2
              wsocket.send('ZM_SetRFIDPosition|0|0|0|2|0|')
              wsocket.send('ZM_PrintLabel|1|1') //打印标签
              //设置密码
              // wsocket.send('ZM_SetRFTagPassWLock|1|2|FF123654|');
              wsocket.send('ClosePort') //关闭端口
              console.log('端口關閉')
              var date = new Date()
              var curDate = null
              do {
                curDate = new Date()
              } while (curDate - date < 3000)

              console.log(this.state)
              if (this.state == 0) {
                this.kl.push(cd.showMap)
              } else {
                return
              }
            }
          } else {
            //打印无logo 打印地址
            for (let cd of LIList) {
              if (cd.number == '' || cd.number == undefined) {
                break
              }
              wsocket.send('OpenPort|' + this.dport + '') //打开端口
              wsocket.send('ZM_ClearBuffer') //清空
              wsocket.send('ZM_SetDirection|' + this.rotate) //設置打印方向
              wsocket.send('ZM_SetPrintSpeed|' + this.speed) //设置速度
              wsocket.send('ZM_SetDarkness|' + this.temperature) //设置温度
              wsocket.send('ZM_SetLabelHeight|368|24') //设置标签高度和间隙 ; [200dpi] 1mm = 8 dot; [300dpi] 1mm=12dot;
              wsocket.send('ZM_SetLabelWidth|780') //设置标签宽度;  [200dpi] 1mm = 8 dot; [300dpi] 1mm=12dot;

              wsocket.send(
                'ZM_DrawTextTrueTypeW|720|130|38|0|宋体|4|900|0|0|0|M0|合格证'
              )
              wsocket.send(
                'ZM_DrawTextTrueTypeW|670|40|26|0|宋体|4|700|0|0|0|M1|款号: '
              )
              wsocket.send(
                'ZM_DrawTextTrueTypeW|670|95|28|0|黑体|4|800|0|0|0|E2|' +
                  cd.kindsNumber.styleNumber +
                  ''
              )

              wsocket.send(
                'ZM_DrawTextTrueTypeW|645|40|26|0|宋体|4|700|0|0|0|E0|' +
                  '尺码:' +
                  cd.sizeNo.split('-')[1] +
                  ''
              )
              if (cd.sizeNumberType != null) {
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|645|130|26|0|宋体|4|700|0|0|0|E1|' +
                    `(${cd.sizeNumberType})` +
                    ''
                )
              }

              wsocket.send(
                'ZM_DrawTextTrueTypeW|620|40|26|0|宋体|4|700|0|0|0|E4|' +
                  '颜色:' +
                  cd.colorNo +
                  '   ' +
                  cd.colorName +
                  ''
              )
              wsocket.send(
                'ZM_DrawTextTrueTypeW|595|40|26|0|宋体|4|700|0|0|0|E5|' +
                  '品名:' +
                  cd.kindsNumber.commodityName +
                  ''
              )
              wsocket.send(
                'ZM_DrawTextTrueTypeW|570|40|26|0|宋体|4|700|0|0|0|E6|等级:合格品'
              )
              wsocket.send(
                'ZM_DrawTextTrueTypeW|570|180|26|0|宋体|4|700|0|0|0|E7|' +
                  '检验员:' +
                  cd.kindsNumber.supplier +
                  ''
              ) //检验员
              // wsocket.send('ZM_DrawTextTrueTypeW|545|40|26|0|宋体|4|700|0|0|0|E8|面料:');
              if (this.checkKindsNumberIngredient == false) {
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|545|40|26|0|宋体|4|700|0|0|0|B5|' +
                    cd.kindsNumberIngredient.ingredientOne +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|520|40|26|0|宋体|4|700|0|0|0|B6|' +
                    cd.kindsNumberIngredient.ingredientTwo +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|495|40|26|0|宋体|4|700|0|0|0|B7|' +
                    cd.kindsNumberIngredient.ingredientThree +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|470|40|26|0|宋体|4|700|0|0|0|B8|' +
                    cd.kindsNumberIngredient.ingredientFour +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|445|40|26|0|宋体|4|700|0|0|0|B9|' +
                    cd.kindsNumberIngredient.ingredientFive +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|420|40|26|0|宋体|4|700|0|0|0|C0|' +
                    cd.kindsNumberIngredient.ingredientSix +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|395|40|26|0|宋体|4|700|0|0|0|C1|' +
                    cd.kindsNumberIngredient.ingredientSeven +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|370|40|26|0|宋体|4|700|0|0|0|C2|' +
                    cd.kindsNumberIngredient.ingredientEight +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|345|40|26|0|宋体|4|700|0|0|0|C3|' +
                    cd.kindsNumberIngredient.ingredientNine +
                    ''
                ) //取消换行显示
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|320|40|26|0|宋体|4|700|0|0|0|C4|' +
                    cd.kindsNumberIngredient.ingredientTen +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|295|40|26|0|宋体|4|700|0|0|0|C5|' +
                    cd.kindsNumberIngredient.ingredientEleven +
                    ''
                )
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|270|40|20|0|新宋体|4|700|0|0|0|G7|' +
                    cd.kindsNumberIngredient.ingredientTwelve +
                    ''
                )
                // wsocket.send('ZM_DrawTextTrueTypeW|245|40|20|0|新宋体|4|700|0|0|0|F1|' + cd.kindsNumberIngredient.ingredientThirteen +'');
              } else {
                wsocket.send(
                  'ZM_DrawTextTrueTypeW|545|40|26|0|宋体|4|700|0|0|0|D5|成份明细见水唛'
                )
              }

              wsocket.send(
                'ZM_DrawTextTrueTypeW|250|40|26|0|宋体|4|700|0|0|0|B1|' +
                  '执行标准:' +
                  cd.kindsNumberIngredient.standard +
                  ''
              )
              wsocket.send(
                'ZM_DrawTextTrueTypeW|220|38|24|0|宋体|4|700|0|0|0|B2|' +
                  '安全技术类别:' +
                  cd.kindsNumberIngredient.safetyType +
                  ''
              )
              if (cd.kindsNumberIngredient.safetyType != '') {
                if (
                  cd.kindsNumberIngredient.safetyType.substring(
                    cd.kindsNumberIngredient.safetyType.length - 2
                  ) == 'B类'
                ) {
                  wsocket.send(
                    'ZM_DrawTextTrueTypeW|190|80|26|0|宋体|4|700|0|0|0|B1|' +
                      '(直接接触皮肤类)'
                  )
                } else {
                  wsocket.send(
                    'ZM_DrawTextTrueTypeW|190|80|26|0|宋体|4|700|0|0|0|B1|' +
                      '(非直接接触皮肤类)'
                  )
                }
              }
              // wsocket.send('ZM_DrawTextTrueTypeW|120|40|28|0|黑体|4|800|0|0|0|A1|' + '货号码: ' + cd.kindsNumbers +'');
              wsocket.send(
                'ZM_DrawTextTrueTypeW|160|40|36|0|宋体|4|900|0|0|0|C9|' +
                  '零售价：'
              )
              wsocket.send(
                'ZM_DrawTextTrueTypeW|165|180|46|0|Arial|4|900|0|0|0|D9|' +
                  cd.kindsNumber.sellingPrice +
                  '.00'
              )
              //地址
              wsocket.send(
                'ZM_DrawTextTrueTypeW|120|40|23|0|宋体|4|700|0|0|0|G1|重庆瑞谷锦服饰有限责任公司'
              )
              wsocket.send(
                'ZM_DrawTextTrueTypeW|95|40|23|0|宋体|4|700|0|0|0|G2|工厂地址:重庆市回兴街道'
              )
              wsocket.send(
                'ZM_DrawTextTrueTypeW|70|40|23|0|宋体|4|700|0|0|0|G3|两港大道211号厂房6-1'
              )
              wsocket.send(
                'ZM_DrawTextTrueTypeW|45|40|23|0|宋体|4|700|0|0|0|G4|电话：023-67410336'
              )

              console.log(cd.sixID, cd.kindsNumbers)
              wsocket.send(
                'ZM_DrawBarcode|65|325|0|1|1|2|40|66|' + cd.sixID + ''
              )
              wsocket.send(
                'ZM_DrawTextTrueTypeW|170|345|24|0|宋体|1|900|0|0|0|D0|' +
                  cd.sixID +
                  ''
              )
              wsocket.send(
                'ZM_DrawBarcode|550|325|0|1|1|2|40|N|' + cd.kindsNumbers + ''
              ) //货号一维码    横向
              // //写卡 //向 EPC 区，写入数据格式为 16 进制的数据,共写入 12 个字节的数据："313030333731363045424151"
              wsocket.send('ZM_RW_RfidFormat|1|0|0|12|1|' + cd.rFID + '')
              console.log(typeof cd.rFID)
              //校验1
              wsocket.send('ZM_SetRFTagRetryCount|1|')
              //校验2
              wsocket.send('ZM_SetRFIDPosition|0|0|0|2|0|')
              wsocket.send('ZM_PrintLabel|1|1') //打印标签
              //设置密码
              // wsocket.send('ZM_SetRFTagPassWLock|1|2|FF123654|');
              wsocket.send('ClosePort') //关闭端口
              console.log('端口關閉')
              var date = new Date()
              var curDate = null
              do {
                curDate = new Date()
              } while (curDate - date < 3000)

              console.log(this.state)
              if (this.state == 0) {
                this.kl.push(cd.showMap)
              } else {
                return
              }
            }
          }
        }
      } else {
        //非瑞古锦版本打印
        for (var cd of LIList) {
          // for(let sl=0;sl<cd.number;sl++){
          if (cd.number == '' || cd.number == undefined) {
            break
          }
          // console.log(LIList.length)
          wsocket.send('OpenPort|' + this.dport + '') //打开端口
          wsocket.send('ZM_ClearBuffer') //清空
          wsocket.send('ZM_SetDirection|' + this.rotate + '') //設置打印方向
          wsocket.send('ZM_SetPrintSpeed|' + this.speed + '') //设置速度
          wsocket.send('ZM_SetDarkness|' + this.temperature + '') //设置温度
          wsocket.send('ZM_SetLabelHeight|368|24') //设置标签高度和间隙 ; [200dpi] 1mm = 8 dot; [300dpi] 1mm=12dot;
          wsocket.send('ZM_SetLabelWidth|780') //设置标签宽度;  [200dpi] 1mm = 8 dot; [300dpi] 1mm=12dot;
          //if( TIDCode.length>0)

          wsocket.send(
            'ZM_DrawTextTrueTypeW|695|130|34|0|宋体|4|800|0|0|0|A0|合格证'
          ) //打印文字
          wsocket.send(
            'ZM_DrawTextTrueTypeW|645|20|20|0|新宋体|4|700|0|0|0|A1|款号: '
          )
          wsocket.send(
            'ZM_DrawTextTrueTypeW|655|75|36|0|黑体|4|900|0|0|0|A9|' +
              cd.kindsNumber.styleNumber +
              ''
          )
          // wsocket.send('ZM_DrawTextTrueTypeW|655|75|36|0|黑体|4|900|0|0|0|A9|' + cd.kindsNumbers +'');//货号
          wsocket.send(
            'ZM_DrawTextTrueTypeW|610|20|20|0|新宋体|4|700|0|0|0|A2|' +
              '品名:' +
              cd.kindsNumber.commodityName +
              ''
          )
          wsocket.send(
            'ZM_DrawTextTrueTypeW|585|20|20|0|新宋体|4|700|0|0|0|A3|' +
              '尺码:' +
              cd.sizeNo.split('-')[1] +
              ''
          )
          if (cd.sizeNumberType != null) {
            wsocket.send(
              'ZM_DrawTextTrueTypeW|585|130|20|0|新宋体|4|700|0|0|0|J0|' +
                `(${cd.sizeNumberType})` +
                ''
            )
          }

          wsocket.send(
            'ZM_DrawTextTrueTypeW|560|20|20|0|新宋体|4|700|0|0|0|A4|' +
              '色段:' +
              `${
                cd.otherSizeSet == null
                  ? ''
                  : JSON.stringify(cd.otherColorSet)
                      .replace(/[色]/g, '')
                      .replace(/\[|]/g, '')
                      .replace(/\"|"/g, '')
              } (${cd.kindsNumberIngredient.containNo})` +
              ''
          )

          wsocket.send(
            'ZM_DrawTextTrueTypeW|535|20|20|0|新宋体|4|700|0|0|0|A5|' +
              '颜色:' +
              cd.colorNo +
              '   ' +
              cd.colorName +
              ''
          )
          // wsocket.send('ZM_DrawTextTrueTypeW|535|170|20|0|新宋体|4|700|0|0|0|A6|' + '检验员:' + cd.kindsNumberIngredient.operator + '');
          wsocket.send(
            'ZM_DrawTextTrueTypeW|535|170|20|0|新宋体|4|700|0|0|0|A6|' +
              '检验员:' +
              cd.kindsNumber.supplier +
              ''
          ) //检验员

          wsocket.send(
            'ZM_DrawTextTrueTypeW|510|20|20|0|新宋体|4|700|0|0|0|A7|计价单位:件'
          )
          wsocket.send(
            'ZM_DrawTextTrueTypeW|510|150|20|0|新宋体|4|700|0|0|0|A8|产品等级:合格品'
          )

          wsocket.send(
            'ZM_DrawTextTrueTypeW|485|20|20|0|新宋体|4|700|0|0|0|B1|' +
              '执行标准:' +
              cd.kindsNumberIngredient.standard +
              ''
          )
          wsocket.send(
            'ZM_DrawTextTrueTypeW|460|20|20|0|新宋体|4|700|0|0|0|B2|' +
              '安全类别:' +
              cd.kindsNumberIngredient.safetyType +
              ''
          )
          // wsocket.send('ZM_DrawTextTrueTypeW|435|100|20|0|新宋体|4|700|0|0|0|B3|' + this.lb + '');/* 未获取*/

          wsocket.send(
            'ZM_DrawTextTrueTypeW|410|20|20|0|新宋体|4|700|0|0|0|B4|面料成份:'
          )
          if (this.checkKindsNumberIngredient == false) {
            wsocket.send(
              'ZM_DrawTextTrueTypeW|390|20|20|0|新宋体|4|700|0|0|0|B5|' +
                cd.kindsNumberIngredient.ingredientOne +
                ''
            )
            wsocket.send(
              'ZM_DrawTextTrueTypeW|370|20|20|0|新宋体|4|700|0|0|0|B6|' +
                cd.kindsNumberIngredient.ingredientTwo +
                ''
            )
            wsocket.send(
              'ZM_DrawTextTrueTypeW|350|20|20|0|新宋体|4|700|0|0|0|B7|' +
                cd.kindsNumberIngredient.ingredientThree +
                ''
            )
            wsocket.send(
              'ZM_DrawTextTrueTypeW|330|20|20|0|新宋体|4|700|0|0|0|B8|' +
                cd.kindsNumberIngredient.ingredientFour +
                ''
            )
            wsocket.send(
              'ZM_DrawTextTrueTypeW|310|20|20|0|新宋体|4|700|0|0|0|B9|' +
                cd.kindsNumberIngredient.ingredientFive +
                ''
            )
            wsocket.send(
              'ZM_DrawTextTrueTypeW|290|20|20|0|新宋体|4|700|0|0|0|C0|' +
                cd.kindsNumberIngredient.ingredientSix +
                ''
            )
            wsocket.send(
              'ZM_DrawTextTrueTypeW|270|20|20|0|新宋体|4|700|0|0|0|C1|' +
                cd.kindsNumberIngredient.ingredientSeven +
                ''
            )
            wsocket.send(
              'ZM_DrawTextTrueTypeW|250|20|20|0|新宋体|4|700|0|0|0|C2|' +
                cd.kindsNumberIngredient.ingredientEight +
                ''
            )
            wsocket.send(
              'ZM_DrawTextTrueTypeW|230|20|20|0|新宋体|4|700|0|0|0|C3|' +
                cd.kindsNumberIngredient.ingredientNine +
                ''
            )
            wsocket.send(
              'ZM_DrawTextTrueTypeW|210|20|20|0|新宋体|4|700|0|0|0|C4|' +
                cd.kindsNumberIngredient.ingredientTen +
                ''
            )
            wsocket.send(
              'ZM_DrawTextTrueTypeW|190|20|20|0|新宋体|4|700|0|0|0|C5|' +
                cd.kindsNumberIngredient.ingredientEleven +
                ''
            )
            wsocket.send(
              'ZM_DrawTextTrueTypeW|180|20|20|0|新宋体|4|700|0|0|0|G3|' +
                cd.kindsNumberIngredient.ingredientTwelve +
                ''
            )

            wsocket.send(
              'ZM_DrawTextTrueTypeW|390|180|20|0|新宋体|4|700|0|0|0|F1|' +
                cd.kindsNumberIngredient.ingredientThirteen +
                ''
            )
            wsocket.send(
              'ZM_DrawTextTrueTypeW|370|180|20|0|新宋体|4|700|0|0|0|F2|' +
                cd.kindsNumberIngredient.ingredientFourteen +
                ''
            )
            wsocket.send(
              'ZM_DrawTextTrueTypeW|350|180|20|0|新宋体|4|700|0|0|0|F3|' +
                cd.kindsNumberIngredient.ingredientFifteen +
                ''
            )
            wsocket.send(
              'ZM_DrawTextTrueTypeW|330|180|20|0|新宋体|4|700|0|0|0|F4|' +
                cd.kindsNumberIngredient.ingredientSixteen +
                ''
            )
            wsocket.send(
              'ZM_DrawTextTrueTypeW|310|180|20|0|新宋体|4|700|0|0|0|F5|' +
                cd.kindsNumberIngredient.ingredientSeventeen +
                ''
            )
            wsocket.send(
              'ZM_DrawTextTrueTypeW|290|180|20|0|新宋体|4|700|0|0|0|F6|' +
                cd.kindsNumberIngredient.ingredientEighteen +
                ''
            )
            wsocket.send(
              'ZM_DrawTextTrueTypeW|270|180|20|0|新宋体|4|700|0|0|0|F7|' +
                cd.kindsNumberIngredient.ingredientNineteen +
                ''
            )
            wsocket.send(
              'ZM_DrawTextTrueTypeW|250|180|20|0|新宋体|4|700|0|0|0|F8|' +
                cd.kindsNumberIngredient.ingredientTwenty +
                ''
            )
            wsocket.send(
              'ZM_DrawTextTrueTypeW|230|180|20|0|新宋体|4|700|0|0|0|F9|' +
                cd.kindsNumberIngredient.ingredientTwentyOne +
                ''
            )
            wsocket.send(
              'ZM_DrawTextTrueTypeW|210|180|20|0|新宋体|4|700|0|0|0|G1|' +
                cd.kindsNumberIngredient.ingredientTwentyTwo +
                ''
            )
            // wsocket.send('ZM_DrawTextTrueTypeW|190|180|20|0|新宋体|4|700|0|0|0|G2|' + cd.kindsNumberIngredient.ingredientTwentyThree +'');
            // wsocket.send('ZM_DrawTextTrueTypeW|170|180|20|0|新宋体|4|700|0|0|0|G4|' + cd.kindsNumberIngredient.ingredientTwentyFour +'');
          } else {
            wsocket.send(
              'ZM_DrawTextTrueTypeW|390|20|20|0|新宋体|4|700|0|0|0|D5|成份明细见水唛'
            )
          }

          if (this.isVip == true) {
            wsocket.send(
              'ZM_DrawTextTrueTypeW|155|20|20|0|新宋体|4|700|0|0|0|C7|' +
                'VIP价:' +
                cd.kindsNumber.vipPrice +
                ''
            ) //vip价
          }

          wsocket.send(
            'ZM_DrawTextTrueTypeW|55|30|20|0|新宋体|4|700|0|0|0|C8|' +
              '产地:' +
              this.city +
              ''
          )
          wsocket.send(
            'ZM_DrawTextTrueTypeW|65|200|46|0|Arial|4|900|0|0|0|C9|' +
              '￥' +
              cd.kindsNumber.sellingPrice +
              '.00'
          )

          // wsocket.send('ZM_DrawLineXor|250|170|200|3');//画直线
          // wsocket.send('ZM_DrawBar2D_QR|16|120|8|8|0|2|4|0|8|ZMIN Test');//打印QR二维条码
          // wsocket.send('ZM_DrawBarcode|150|20|0|1|30|4|30|66|2018072001');//打印一维条码
          if (cd.kindsNumberIngredient.ean13No != '') {
            wsocket.send(
              'ZM_DrawBarcode|160|30|1|E30|3|4|50|66|' +
                cd.kindsNumberIngredient.ean13No +
                ''
            ) //打印一维条码 EN13码
          }

          // wsocket.send('ZM_DrawBarcode|175|60|1|1|2|3|60|66|6971297491007');//EN13码

          wsocket.send('ZM_DrawBarcode|170|340|0|1|1|2|40|66|' + cd.sixID + '')
          wsocket.send(
            'ZM_DrawTextTrueTypeW|90|350|24|0|新宋体|1|900|0|0|0|D0|' +
              cd.sixID +
              ''
          )
          wsocket.send(
            'ZM_DrawBarcode|450|340|0|1|1|2|40|N|' + cd.kindsNumbers + ''
          ) //货号一维码

          // wsocket.send('ZMWIN_SetRFIDPosition|0|0|3|1|0')//RFID标签重复两次抓取写卡位置有错
          // wsocket.send('ZMWIN_SetRFTagRetryCount|1')//RFID标签重复两次有错!请检查！

          // //写卡 //向 EPC 区，写入数据格式为 16 进制的数据,共写入 12 个字节的数据："313030333731363045424151"
          console.log(typeof cd.rFID)
          wsocket.send('ZM_RW_RfidFormat|1|0|0|12|1|' + cd.rFID + '')
          //校验1
          wsocket.send('ZM_SetRFTagRetryCount|1|')
          //校验2
          wsocket.send('ZM_SetRFIDPosition|0|0|0|2|0|')
          //RFID 报错现象: 打印机前面板的纸张/MEDIA 指示灯将闪烁;
          wsocket.send('ZM_PrintLabel|1|1') //打印标签

          //设置密码
          // wsocket.send('ZM_SetRFTagPassWLock|1|2|FF123654|');

          wsocket.send('ClosePort') //关闭端口
          console.log('端口關閉')

          //180813 此处需增加延时,保证打印完当前标签;
          var date = new Date()
          var curDate = null
          do {
            curDate = new Date()
          } while (curDate - date < 3000)

          console.log(this.state)
          if (this.state == 0) {
            this.kl.push(cd.showMap)
          } else {
            return
          }
        }
      }
    },

    getStatus() {
      //获取打印机状态
      wsocket.send('OpenPort|' + this.dport + '')
      wsocket.send('ZM_ErrorReportEx|0|0|0|1|0')
      wsocket.send('ClosePort')
    },

    dele() {
      localStorage.jxPrintList = ''
      this.tagsData = []
      console.log(this.contener)
      localStorage.removeItem('dData')
      localStorage.removeItem('connectData')
      // this.printPort = '1808'
      // this.printIp = 'jiaxinoy.oicp.net'
      this.$message({
        type: 'success',
        message: '已清除缓存!'
      })
    },
    //获取打印列表
    getPrintList() {
      if (this.addStyleNumber) {
        let tmp = []
        getArtNo({
          pageSize: 999,
          page: 1,
          groupType: 1,
          styleNumber: this.addStyleNumber
        }).then((res) => {
          if (res.data.code == 200) {
            for (let n of res.data.data) {
              if (!tmp.includes(n.kindsNumber)) {
                tmp.push(n.kindsNumber)
              }
            }
            localStorage.jxPrintList = tmp
            console.log(tmp)
            var io = JSON.stringify(tmp).replace(/^\{|\}$/g, '')
            var ip = io.replace(/\[|]/g, '').replace(/\"|"/g, '')
            // console.log(ip)
            if (ip == '') return
            let obj = { kindsNumberList: ip }
            getWashdata(obj).then((res) => {
              var sdMsg = res.data.data
              // var sdMsg2 = sdMsg       //将数组里kindsNumber对象里的属性拿出来放置与kindsNumber平级
              if (sdMsg != null) {
                sdMsg.map((item, index) => {
                  sdMsg.push(
                    Object.assign({}, item, {
                      kindsNumbers: item.kindsNumber.kindsNumber,
                      colorName: item.kindsNumber.colorName,
                      colorNo: item.kindsNumber.colorNo,
                      sellingPrice: item.kindsNumber.sellingPrice,
                      sizeNo: item.kindsNumber.sizeNo,
                      mnemonicCode: item.kindsNumber.mnemonicCode,
                      finishNumber:
                        item.barcodeWashPrint == null
                          ? 0
                          : item.barcodeWashPrint.finishNumber
                    })
                  )
                })
              }
              // console.log(sdMsg) //map复制了数组 添加的数组里深层对象为空去掉为空
              var sdMsg2 = []
              for (let ab of sdMsg) {
                if (ab.sizeNo != undefined || ab.colorNo != undefined) {
                  sdMsg2.push(ab)
                }
              }
              // console.log(sdMsg2);

              this.$root.Bus.$emit('send', sdMsg2)
              this.addStyleNumber = ''
              this.getPrintList()
            })
          }
        })
        return
      }

      if (this.printerType) {
        // console.log(localStorage.jxPrintList)
        if (localStorage.jxPrintList) {
          getWashdata({ kindsNumberList: localStorage.jxPrintList }).then(
            (res) => {
              this.tagsData = res.data.data || []
              this.tagsData.sort((a, b) => {
                return a.kindsNumber.kindsNumber.localeCompare(
                  b.kindsNumber.kindsNumber
                )
              })
              let lastType = ''
              let colorMap = {}
              let sizeMap = {}
              this.tagsData.forEach((e) => {
                e.kindsNumbers = e.kindsNumber.kindsNumber
                e.sellingPrice = e.kindsNumber.sellingPrice
                e.sizeNo = e.kindsNumber.sizeNo
                e.number = ''
                e.finishNumber = ''
                e.mnemonicCode = e.kindsNumber.mnemonicCode
                e.styleNumber = e.kindsNumber.styleNumber
                e.colorNo = e.kindsNumber.colorNo
                e.colorName = e.kindsNumber.colorName
                e.size = this.allSizeMap[e.kindsNumber.relevanceSize]

                if (e.styleNumber != lastType) {
                  lastType = e.styleNumber
                  colorMap[lastType] = [e.colorName]
                  sizeMap[lastType] = [e.size]
                } else {
                  if (colorMap[lastType].indexOf(e.colorName) == -1) {
                    colorMap[lastType].push(e.colorName)
                  }
                  if (sizeMap[lastType].indexOf(e.size) == -1) {
                    sizeMap[lastType].push(e.size)
                  }
                }
              })

              console.log(colorMap)
              console.log(sizeMap)

              this.printColorMap = colorMap
              this.printSizeMap = sizeMap
            }
          )
        }
        return
      }

      var lpl = localStorage.getItem('dData')
      this.tData = typeof lpl == 'string' ? JSON.parse(lpl) : lpl
      this.tagsData = this.tData

      // this.tabsData.sort((a,b)=>{ //brandedCompany相同的在一起显示
      //   if(a['kindsNumbers'].split('-',[0]) != b['kindsNumbers'].split('-',[0])){
      //     return a['kindsNumbers'].localeCompare(b['kindsNumbers']);
      //   }
      // })

      for (let c in this.tagsData) {
        if (this.tagsData[c].kindsNumberIngredient == null) {
          this.tagsData[c].kindsNumberIngredient = {
            containNo: '',
            standard: '',
            safetyType: '',
            isIncludeMetalFibre: '',
            ean13No: '',
            operator: '',
            ingredientOne: '',
            ingredientTwo: '',
            ingredientThree: '',
            ingredientFour: '',
            ingredientFive: '',
            ingredientSix: '',
            ingredientSeven: '',
            ingredientEight: '',
            ingredientNine: '',
            ingredientTen: '',
            ingredientEleven: '',
            ingredientTwelve: '',
            ingredientThirteen: '',
            ingredientFourteen: '',
            ingredientFifteen: '',
            ingredientSixteen: '',
            ingredientSeventeen: '',
            ingredientEighteen: '',
            ingredientNineteen: '',
            ingredientTwenty: '',
            ingredientTwentyOne: '',
            ingredientTwentyTwo: '',
            ingredientTwentyThree: '',
            ingredientTwentyFour: '',
            ingredientTwentyFive: '',
            washingType: '',
            WashingFigure_1: '',
            WashingFigure_2: '',
            WashingFigure_3: '',
            WashingFigure_4: '',
            WashingFigure_5: '',
            WashingFigure_6: ''
          }
        }
      }
      console.log(this.tagsData)
    }
  },

  created() {
    let jxQuarterVal = document.cookie.match(RegExp('jxQuarter' + '=([^;]+)'))
    this.jxQuarter = jxQuarterVal ? jxQuarterVal[1] : null
    
    let obj = {
      label: this.$route.query.label,
      name: this.$route.query.name
    }
    // console.log(obj)
    this.$store.commit('addNav', obj)
    if (localStorage.getItem('connectData') != null) {
      this.printAddress = localStorage.getItem('connectData').split(',')[0]
      this.printIp = localStorage.getItem('connectData').split(',')[1]
      this.printPort = localStorage.getItem('connectData').split(',')[2]
    }
    this.inpList = this.getInput()
    //获取打印机温度，速度，等参数
    this._getPrintData()

    // this.connection()
    this.$root.Bus.$on('send', function (val) {
      this.contener = JSON.stringify(val)
      localStorage.setItem('dData', this.contener)
      console.log(JSON.parse(this.contener))
    })
    var sendData = this.$route.query.sendData
    console.log(this.$route.query.sendData)

    this.getPrintList()

    this.tag = this.$route.query.fid == 1 ? true : false

    //获取客户列表
    getClient().then((res) => {
      // console.log(res)
      if (res.data.code == 200) {
        this.customerSelectList = []
        this.customerList = res.data.data
        this.customerList.forEach((e) => {
          this.customerSelectList.push({
            value: e.name,
            label: e.name,
            no: e.no
          })
        })
      }
    })
  },
  beforeDestroy() {
    this.$root.Bus.$off('send')
    if (wsocket.readyState == 1) wsocket.close()
    localStorage.removeItem('dData')
    localStorage.removeItem('jxPrintList')
  },
  mounted() {
    let _this = this
    document.onkeydown = function (event) {
      let e = event || window.event || arguments.callee.caller.arguments[0]
      if (e && e.keyCode == 113) {
        // 按 F2
        if (_this.showParameter == 'none') {
          _this.showParameter = 'block'
        } else {
          _this.showParameter = 'none'
        }
        event.returnValue = false
        event.cancelBubble = true
        return false
      }

      if (e && e.keyCode == 114) {
        // 按 F3
        if (_this.showIconDoc == 'none') {
          _this.showIconDoc = 'block'
        } else {
          _this.showIconDoc = 'none'
        }
        event.returnValue = false
        event.cancelBubble = true
        return false
      }
      // else if(e && e,keyCode==114 && _this.showParameter == 'block'){
      //   _this.showIconDoc = 'none'
      // }
    }
  }
}
</script>
